//
//  SEDepartmentListCell.swift
//  SmartEyeForPatient
//
//  Created by QDSG on 2021/4/12.
//

import UIKit

class SEDepartmentListCell: UICollectionViewCell {
    
    override func awakeFromNib() {
        super.awakeFromNib()
        backgroundColor = .clear
        contentView.backgroundColor = .clear
    }
    
    func update(with viewModel: SEDepartmentItemViewModel) {
        nameLabel.text = viewModel.model.departmentName
    }
    
    func setSelectedHighlight(_ highlight: Bool) {
        containerView.backgroundColor = highlight
            ? UIColor(hex: "#F6F8FE").withAlphaComponent(0.5)
            : UIColor(hex: "#F6F8FE")
    }
    
    @IBOutlet private weak var containerView: UIView! {
        didSet {
            containerView.backgroundColor = Asset.departmentBackground.color
            containerView.layer.cornerRadius = 8
            containerView.layer.borderWidth = 1
            containerView.layer.borderColor = Asset.departmentBorder.color.cgColor
        }
    }
    
    @IBOutlet private weak var nameLabel: UILabel!
}
